package foodmaterial.dao;

import foodmaterial.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface PermissionDao {

    int insertPermission(List<SysPermission> sysPermissions) ;

    int deletePermission() ;

    int insertRole(SysRole sysRole) ;

    int updateRole(SysRole sysRole) ;

    int deleteRole(Long id) ;

    List<SysRole> selectRole() ;

    int insertUser(SysUser sysUser) ;

    int updateUser(SysUser sysUser) ;

    List<SysUser> selectUsers(@Param("userType") String userType,
                              @Param("hasSupper") String hasSupper,
                              @Param("branchId") Long branchId,
                              @Param("name") String name) ;

    List<SysUser> selectAdminUsers(@Param("dbList") List<String> dbList) ;

    List<Map<String,Object>> choiceUsers(@Param("db") String db,
                                         @Param("userType") String userType) ;

    SysUser selectUserByAccount(String account) ;

    SysUser selectUserByAdmin(String account) ;

    SysUser selectCustomerByAccount(String code,String db);

    SysUser selectUserById(Long id) ;

    List<SysRole> selectRolesByUser(Long userId) ;

    List<SysPermission> selectPermissionsByUser(Long userId) ;

    List<SysPermission> selectPermissions() ;

    List<SysUrl> selectUrl();

    int insertUserRoleRelations(List<UserRoleRelation> userRoleRelationList) ;

    int deleteUserRoleRelations(Long userId) ;

    int deleteRoleUserRelations(Long roleId) ;

    int insertRolePermissionRelations(List<RolePermissionRelation> rolePermissionRelationList) ;

    int deleteRolePermissionRelations(Long roleId) ;

    List<RolePermissionRelation> selectRolePermissionRelation(Long roleId) ;

    List<UserRoleRelation> selectUserRoleRelation(Long userId) ;

    int updateSysParams(CompanySysParams companySysParams) ;
    List<CompanySysParams> selectSysParams() ;
    CompanySysParams selectSysParamsByCode(String code) ;
}
